package vdom

import (
	"io"
	"fmt"
	"html"
	"strconv"
	"reflect"
)


func assert(ok bool) {
	if !(ok) { panic("assertion failed") }
}

func get_addr(ptr interface{}) string {
	var n = reflect.ValueOf(ptr).Pointer()
	return string(fmt.Sprintf("%X", n))
}

func writeRaw(buf io.Writer, content string) {
	fmt.Fprintf(buf, "%s", content)
}
func writeQuotedString(buf io.Writer, str string) {
	fmt.Fprintf(buf, "%s", strconv.Quote(string(str)))
}
func writeHtmlTextString(buf io.Writer, str string) {
	fmt.Fprintf(buf, "%s", html.EscapeString(string(str)))
}
func writeBlank(buf io.Writer, n uint, chunk_size uint) {
	for i := uint(0); i < n; i += 1 {
		for j := uint(0); j < chunk_size; j += 1 {
			fmt.Fprintf(buf, " ")
		}
	}
}
func writeLineFeed(buf io.Writer) {
	fmt.Fprintf(buf, "\n")
}


